#!/bin/bash
###根据自己情况修改###
#Onedirve上传目录(在web上onedrive显示的目录和本地没关系)
UPpath='/Yaaw_Upload'
#Yaaw下载目录
DOWNpath='/aria2_download'
#PHP路径
PHPpath='/bin/php'
#oneindexn路径
ONEpath='/usr/share/nginx/oneindexn'
###无需修改###
path=$3
if [ $2 -eq 0 ]
        then
                exit 0
fi
while true; do
filepath=$path
path=${path%/*};
if [ "$path" = "$DOWNpath" ] && [ $2 -eq 1 ]
    #如果下载的是单个文件
    then
    $PHPpath "$ONEpath"/one.php upload:file "$filepath" "$UPpath"/
    rm -rf "$filepath"
    exit 0
elif [ "$path" = "$DOWNpath" ]
    #下载的是文件夹
    then
    $PHPpath "$ONEpath"/one.php upload:folder "$filepath"/ "$UPpath"/"${filepath##*/}"/
    rm -rf "$filepath"/
    exit 0
fi
